home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / New System Software Extensions / QuickDraw™ GX v1.0ß2 / Interfaces & Libraries / interfaces / selection library.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-29  |  3.1 KB  |  117 lines  |  [TEXT/MPS ]

  1. /* selection library.h -- Routines to manipulate Selection objects.
  2.     
  3. CHANGE LOG
  4.  
  5. Date      Person      Action
  6. ----      ------      ------
  7.  
  8. 911031    DGO       • Created module.
  9.  
  10. */
  11.  
  12. /* Copyright ©1991 Apple Computer, Inc.  All rights reserved. */
  13.  
  14. #ifndef selectionLibraryIncludes
  15. #define selectionLibraryIncludes
  16.  
  17. #ifndef layoutTypesIncludes
  18. #include "layout types.h"
  19. #endif
  20.  
  21. #ifndef graphicsTypesIncludes
  22. #include "graphics types.h"
  23. #endif
  24.  
  25. /* Constants and Enumerations */
  26.  
  27. #define selectionExtremeEdge -1
  28.  
  29. enum {
  30.   emptySelection,
  31.   simpleCaret,
  32.   simpleRange,
  33.   discontiguousRange
  34.   };
  35. typedef unsigned short SelectionType;
  36.  
  37. enum {
  38.   notInSelection,
  39.   partlyInSelection,
  40.   fullyInSelection,
  41.   equalToSelection
  42.   };
  43. typedef unsigned short SelectionMatch;
  44.  
  45. /* Types and Structures */
  46.  
  47. typedef long SelectionOffset;
  48.  
  49. typedef struct {
  50.   SelectionOffset minOffset;  /* earliest char */
  51.   SelectionOffset maxOffset;  /* latest char */
  52.   } SelectionOffsetRange;
  53.  
  54. typedef struct {
  55.   long                  rangeCount;
  56.   SelectionOffsetRange  ranges[];
  57.   } SelectionRanges;
  58.  
  59. typedef struct {
  60.   SelectionOffset offset;
  61.   short           leadingEdge;
  62.   } CaretPiece;
  63.  
  64. typedef struct {
  65.   SelectionType   type;
  66.   union {
  67.     CaretPiece      caret;
  68.     SelectionRanges range;
  69.     } data;
  70.   } Selection, *SelectionPtr, **SelectionHandle;
  71.  
  72. /* Routines */
  73.  
  74. SelectionHandle NewEmptySelection(void);
  75. SelectionHandle NewCaretSelection(SelectionOffset offset, long leadingEdge);
  76. SelectionHandle NewRangeSelection(SelectionOffsetRange *range);
  77.  
  78. SelectionHandle NewFullSelection(void);
  79. SelectionHandle NewStartSelection(SelectionOffset toOffset);
  80. SelectionHandle NewEndSelection(SelectionOffset fromOffset);
  81.  
  82. void SetEmptySelection(SelectionHandle selection);
  83. void SetCaretSelection(SelectionHandle selection, SelectionOffset offset, long leadingEdge);
  84. void SetRangeSelection(SelectionHandle selection, SelectionOffsetRange *range);
  85.  
  86. void SetFullSelection(SelectionHandle selection);
  87. void SetStartSelection(SelectionHandle selection, SelectionOffset toOffset);
  88. void SetEndSelection(SelectionHandle selection, SelectionOffset fromOffset);
  89.  
  90. void DisposeSelection(SelectionHandle selection);
  91.  
  92. SelectionType GetSelectionType(SelectionHandle selection);
  93.  
  94. SelectionOffset GetCaretSelection(SelectionHandle selection, boolean *leadingEdge);
  95. long GetRangeSelection(SelectionHandle selection, SelectionRanges *selectionRanges);
  96.  
  97. SelectionMatch RangeInSelection(SelectionHandle selection, SelectionOffsetRange *range);
  98.  
  99. void InvertSelection(SelectionHandle dest);
  100. void ShiftSelection(SelectionHandle dest, SelectionOffset delta);
  101.  
  102. void UnionSelection(SelectionHandle dest, SelectionHandle source);
  103. void SectSelection(SelectionHandle dest, SelectionHandle source);
  104. void XorSelection(SelectionHandle dest, SelectionHandle source);
  105. void DiffSelection(SelectionHandle dest, SelectionHandle source);
  106.  
  107. gxShape GetLayoutSelection(
  108.   gxShape           layout,
  109.   SelectionHandle selection,
  110.   SelectionOffset lineStart,
  111.   gxHighlightType   highlightType,
  112.   gxCaretType       caretType);
  113.  
  114. SelectionHandle NewDiscontiguousSelection(SelectionRanges *ranges);
  115.  
  116. #endif
  117.